package loja.model.conta.impl;

import javax.persistence.Entity;
import javax.persistence.Table;

import loja.model.conta.ContaAbstrata;
import loja.model.conta.operacao.Operacao;
import loja.services.factory.ServiceFactory;
import loja.services.factory.helper.ServiceFactoryHelper;

@Entity
@Table(name = "conta_cartao_credito_compra")
public class ContaCartaoCreditoCompra extends ContaAbstrata {

	public ContaCartaoCreditoCompra() {
		super();
	}

	@Override
	public void addOperacao(Operacao operacao) {
		super.addOperacao(operacao);

		ServiceFactory serviceFactory = ServiceFactoryHelper
				.getServiceFactory();

		serviceFactory.getDespesaService().consultarPorTitular(getTitular())
				.setValor(getSaldoConta());

	}

}
